package models;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import play.Logger;
import play.db.jpa.GenericModel;
import play.db.jpa.JPA;
import utils.ExceptionUtil;

/**
 * The persistent class for the ticket database table.
 * 
 */
@Entity
@Table(name = "ticketsell")
@NamedQuery(name = "Ticketsell.findBy_netticketid", query = "SELECT t FROM Ticketsell t WHERE t.netticketid=:netticketid ")
public class Ticketsell extends GenericModel implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	public long id;

	public String sellorgcode;

	public String departorgcode;

	public Long schedulepriceid;

	public String ticketno;

	@Temporal(TemporalType.DATE)
	public Date departdate;

	public String schedulecode;

	public String departtime;

	public String seatno;

	public String seattype;

	public Boolean islineschedule;

	public Boolean istakekid;

	public String reachstationcode;

	public Integer distance;

	public BigDecimal fullprice;

	public BigDecimal toplimitprice;

	public String tickettype;

	public double discountrate;

	public BigDecimal price;

	public String paymethod;

	public String ticketentrance;

	public String waitingroom;

	public String buspark;

	public String ticketoutlets;

	public long sellby;

	@Temporal(TemporalType.TIMESTAMP)
	public Date selltime;

	public String sellip;

	public String sellway;

	public String ticketstatus;

	public String netticketid;

	public String orderno;

	public String eticketno;

	public BigDecimal servicefee;

	public Long customerid;

	public String customername;

	public String certificatetype;

	public String certificateno;

	public String phone;

	public String verificationcode;

	public String takestatus;

	public String printbyname;

	@Temporal(TemporalType.TIMESTAMP)
	public Date taketime;

	public String takeway;

	public Integer turnoverdetailid;

	//public BigDecimal returnrate;

	//public BigDecimal returnfee;

	//public boolean iswebreturn;

	//@Temporal(TemporalType.TIMESTAMP)
	//public Date returntime;

	@Temporal(TemporalType.TIMESTAMP)
	public Date createtime;

	public long createby;

	@Temporal(TemporalType.TIMESTAMP)
	public Date updatetime;

	public long updateby;
	
	public String equipmentproviders;
	public String seller;
	public String accountorgcode;
	public String canreturnmoneyback;
	public String startstationname;
	public String venue;
	public Double ticketprice;

	public static Ticketsell findBy_netticketid(String netticketid) {
		try {
			return JPA.em().createNamedQuery("Ticketsell.findBy_netticketid", Ticketsell.class).setParameter("netticketid", netticketid).getSingleResult();
		} catch (Exception e) {
			Logger.log4j.error(ExceptionUtil.getMessageHead(null), e);
			return null;
		}
	}
}